package com.idanchuang.component.redis.util;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author yjy
 * @date 2020/8/31 16:08
 **/
public class PressureRedisKeyUtils {

    public static String getKey(String originKey) {
        return "temp:pressure:" + originKey;
    }

    public static PressureKey getObjKey(Object originKey) {
        return new PressureKey(originKey);
    }

    public static class PressureKey implements Serializable {

        private static final long serialVersionUID = 1L;

        public PressureKey() {
        }

        public PressureKey(Object originKey) {
            this.originKey = originKey;
        }

        private Object originKey;

        public Object getOriginKey() {
            return originKey;
        }

        public void setOriginKey(Object originKey) {
            this.originKey = originKey;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) {
                return true;
            }
            if (o == null || getClass() != o.getClass()) {
                return false;
            }
            PressureKey that = (PressureKey) o;
            return Objects.equals(originKey, that.originKey);
        }

        @Override
        public int hashCode() {
            return Objects.hash(originKey);
        }

        @Override
        public String toString() {
            return "PressureKey{" +
                    "originKey=" + originKey +
                    '}';
        }
    }


}
